import { prop_cur_req_user_identity } from '../../../../../../../../Classes/cla_req_cur_headers_info';
import { req_info_cur_user_function_create } from '../../Classes/cla_req_info_cur_user_function_create';
import { mdb_info_cur_user_functions_active } from './Classes/cla_mdb_info_cur_user_functions_active';
import { mdb_info_cur_user_functions_static_history } from './Classes/cla_mdb_info_cur_user_functions_static_history';
import {
  get_mdb_cur_user_functions_active,
  get_mdb_cur_user_functions_create,
} from './Func/get_mdb_path_cur_user_functions';

/**
 * 添加 历史表 和 信息表 身份 信息
 * @param cur_req_info
 */
export function sign_mdb_cur_user_function_identity(
  cur_req_info: req_info_cur_user_function_create
) {
  let mdb_path_history = get_mdb_cur_user_functions_create(
    cur_req_info[prop_cur_req_user_identity]
  );

  let mdb_path_active = get_mdb_cur_user_functions_active(
    cur_req_info[prop_cur_req_user_identity]
  );

  /**
   * 添加 历史 创建 信息
   */
  let mdb_info_history = new mdb_info_cur_user_functions_static_history(
    cur_req_info
  );

  mdb_path_history.insertOne(mdb_info_history);

  /**
   * 添加 活动表 信息
   */
  let mdb_info_active = new mdb_info_cur_user_functions_active(cur_req_info);

  mdb_path_active.insertOne(mdb_info_active);
}
